//
//  main.m
//  Day8
//
//  Created by wenjim on 17/10/24.
//  Copyright © 2017年 WenJim. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Person.h"

int main(int argc, const char * argv[]) {
    
    /*
//    NSArray * array = [[NSArray alloc] init];
    
//    NSArray * array = [NSArray arrayWithObject:@"cwj"];
    
    // 数组中的nil是结束符
    NSArray * array = [NSArray arrayWithObjects:@"cwj",@"zbc",@"cjl", nil];
    NSLog(@"array = %@",array);
    */
    
    /*
    Person * p = [[Person alloc] init];
    NSObject * obj = [NSObject new];
    NSArray * arr = [NSArray arrayWithObjects:p,obj,@"cwj", nil];
    NSLog(@"arr = %@",arr);
    
    NSLog(@"count = %lu",[arr count]);
    
    NSLog(@"last = %@",[arr lastObject]);
    NSLog(@"first = %@",[arr firstObject]);
    NSLog(@"arr[1]  = %@",[arr objectAtIndex:1]);
    */
    
    /*
    // 是否包含某一个元素
    NSArray * arr = [NSArray arrayWithObjects:@"zs",@"ls",@"ww",@"cwj",@"zbc", nil];
    if ([arr containsObject:@"ls"]) {
        NSLog(@"arr中包含ls");
    }else{
        NSLog(@"arr中不包含ls");
    }
    */
    
    
    // 创建数组简写
    NSString * str = @"cwj";
//    NSArray * arr = [NSArray arrayWithObjects:@"zs",@"ls",@"ww",@"cwj",@"zbc", nil];
    NSArray * arr = @[@"cwj",@"zbc",str];
    
    NSLog(@"arr = %@",arr);
    
    // 获取数组元素的简写
    NSLog(@"%@",[arr objectAtIndex:0]);
    NSLog(@"%@",arr[0]);
    
    
    return 0;
}
